package cn.stimd.spring.beans.factory.support;

import cn.stimd.spring.beans.BeansException;

import java.lang.reflect.Constructor;
import java.lang.reflect.Method;

/**
 * Created by Stimd
 * 项目地址：https://gitee.com/stimd/spring-wheel
 * 公众号：Java编程探微
 */
public interface InstantiationStrategy {
    /**
     * 使用无参构造器创建对象
     */
    Object instantiate(RootBeanDefinition bd, String beanName) throws BeansException;


    /**
     * 使用有参构造器创建对象
     */
    Object instantiate(RootBeanDefinition bd, String beanName, Constructor<?> ctor, Object... args) throws BeansException;


    /**
     * 使用工厂方法创建对象
     */
    Object instantiate(String beanName, Object factoryBean, Method factoryMethod, Object... args) throws BeansException;
}
